<?php
/*
 * help controller 2012.8.16 help.php
 */

class help extends CI_Controller {
	function __construct() {
		parent::__construct ();
		$this->load->helper ( 'url' );
		$this->load->library ('commonClass');
	}
	
	function index(){
		$uid = commonClass::Listion_user ();
		if ($uid) {
			$lang['uid'] = $_SESSION['uid'];
			$lang['usermail'] = $_SESSION['usermail'];
		}
		$lang["modle"] = "help";
		//��ȡ������Ϣ
		$lang['data'] = $this->m_tbk->get_help();
		$this->load->view('public/v_help',$lang);
	}
	function trade_check_is(){
		session_start();
		$trade_parent_id = $_POST["trade_parent_id"];
		$sql = "select `rec_id` from tb_tbk_report where `trade_parent_id`=$trade_parent_id and `outer_code`=0";
		if($this->m_tbk->tbk_query($sql)){
			$uid = $_SESSION["uid"];
			$sql = "UPDATE `tb_tbk_report` SET `outer_code`= '$uid' where `trade_parent_id` =$trade_parent_id and `outer_code`=0";
			if($this->m_tbk->querys($sql)){
				$result["state"] = 1;
			}else 
				$result["state"] = 2;
		}else {//订单号不存在
			$result["state"] = 0;
		}
		echo json_encode($result);
	}
	
}